package com.company.project.controller.ldjsc.home;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.company.project.entity.ldjsc.home.JscJjyxZbkdTwoEntity;
import com.company.project.entity.ldjsc.jjyx.JscJjyxAqscEntity;
import com.company.project.service.ldjsc.home.JscJjyxZbkdTwoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.company.project.common.utils.DataResult;



/**
 *
 *
 * @author wenbin
 * @email *****@mail.com
 * @date 2025-08-11 18:08:24
 */
@Controller
@RequestMapping("/sxzy")
public class JscJjyxZbkdTwoController {
    @Autowired
    private JscJjyxZbkdTwoService jscJjyxZbkdTwoService;


    @ApiOperation(value = "指标快递2")
    @GetMapping("/jsc-dd-zt/Jsczbkdtwo2")
    @ResponseBody
    public DataResult findListByPage(JscJjyxZbkdTwoEntity jscJjyxZbkdTwo){
        LambdaQueryWrapper<JscJjyxZbkdTwoEntity> queryWrapper = Wrappers.lambdaQuery();
        //查询条件示例
        if (jscJjyxZbkdTwo.getMidgard_offset() != null){
            jscJjyxZbkdTwo.setMidgard_page(1);
        }
        queryWrapper.orderByDesc(JscJjyxZbkdTwoEntity::getYears_max);
        IPage<JscJjyxZbkdTwoEntity> iPage = jscJjyxZbkdTwoService.page(jscJjyxZbkdTwo.getQueryPage(), queryWrapper);
        List<JscJjyxZbkdTwoEntity> records = iPage.getRecords();


        // 构造所需的数据结构
        List<String> columnNames = Arrays.asList(
                "source",
                "dept",
                "title",
                "refine_name",
                "num1_array",
                "num2_array",
                "years_array",
                "time_value_array",
                "url",
                "years_max",
                "type_name"
        );

        Map<String, Object> result = new HashMap<>();
        result.put("columnNames", columnNames);
        result.put("value", records);

        return DataResult.success(result);
    }


}
